//
//  StatuesCell.swift
//  sinaweibo
//
//  Created by icefs2 on 15/11/14.
//  Copyright © 2015年 icefs2. All rights reserved.
//

import UIKit
import SnapKit

let StatusCellMargin: CGFloat = 12
let StatusCellIconWitdth: CGFloat = 35

class StatuesCell: UITableViewCell {
    
    //数据模型
    var status: Status? {
        didSet {
            //原创微博的数据模型
            OraigianView.status = status
            
        }
    }
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setUpUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    //设置ui
    private func setUpUI() {
        //添加子试图
        contentView.addSubview(OraigianView)
       
        contentView.addSubview(buttonview)
        
        //设置约束
        OraigianView.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(contentView.snp_top)
            make.left.equalTo(contentView.snp_left)
            make.right.equalTo(contentView.snp_right)
            
        }
   
        buttonview.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(OraigianView.snp_bottom).offset(StatusCellMargin)
            make.left.equalTo(contentView.snp_left)
            make.right.equalTo(contentView.snp_right)
            make.height.equalTo(40)
        }
        contentView.snp_makeConstraints { (make) -> Void in
            make.bottom.equalTo(buttonview.snp_bottom)
            make.top.equalTo(self.snp_top)
            make.left.equalTo(self.snp_left)
            make.right.equalTo(self.snp_right)
        }
    }
    
    //懒加载控件
    private lazy var OraigianView: StatusOraigianView = StatusOraigianView()
    private lazy var buttonview: StatusCellBottomView = StatusCellBottomView()
}

